import './assets/main.css'
// 引入设置的store
import store from "../store";
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
// import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/src/index.scss'
import microApp from '@micro-zoe/micro-app';
import { jobType as jobTypeArr } from '@/assets/js/dictData'
window.jobTypeArr = jobTypeArr

microApp.start({
  'disable-memory-router': true, // 关闭虚拟路由系统
  // globalAssets: {
  //   js: [],
  //   css:[]
  // },
  // prefetchDelay：5000,
  // prefetchApps: [
  //   {
  //     name: 'childHome',
  //     url: 'http://localhost:3000/childHome/',
  //     level:3
  //   },
  //   {
  //     name: 'childJob',
  //     url: 'http://localhost:3001',
  //     level:3
  //   },
  //   {  
  //     name: 'childEnterprise',
  //     url: 'http://localhost:3002/child/child-vue3-enterprise/',
  //     level: 3,
  //     iframe:true
  //   },
  //   {
  //     name: 'childAbout',
  //     url: 'http://localhost:3003/',
  //     level:3
  //   }
  // ],
  lifeCycles: {
    created() { 
      
    },
    beforemount() { 
      
    },
    mounted() { 
     const loading = document.querySelector("#appLoading")
     console.log('在基座应用中监听子应用元素loading',loading) 
    },
    unmount() { 

    },
    error() { 

    }
  },
  // globalAssets: {
  //   js: ['../public/commonJs.js'], // js地址
  //   css: ['../public/commonFont.css'], // css地址
  // }
})
// 预加载
microApp.preFetch([
  { name: 'childHome', url: 'http://localhost:3004/childHome/', level: 3  }, // 加载资源、解析并渲染
  { name: 'childJob', url: 'http://localhost:3001/', level: 3 }, // 加载资源、解析并渲染
  { name: 'childEnterprise', url: 'http://localhost:3002/child/child-vue3-enterprise/', level: 3,   iframe: true }, // 加载资源、解析并渲染
  { name: 'childAbout', url: 'http://localhost:3003/', level: 3 }, // 加载资源、解析并渲染
  { name: 'childDemo', url: 'https://micro-zoe.github.io/micro-app/', level: 3 }, // 加载资源、解析并渲染
])

microApp.preFetch([
  {
    name: 'childHome',
    url: 'http://localhost:3004/childHome/',
    level:3
  },
  {
    name: 'childJob',
    url: 'http://localhost:3001',
    level:2
  },
  {
    name: 'childEnterprise',
    url: 'http://localhost:3002/child/child-vue3-enterprise/',
    level: 3,
    iframe:true
  },
  {
    name: 'childAbout',
    url: 'http://localhost:3003/',
    level:3
  }
],5000)
microApp.router.setBaseAppRouter(router)
const app = createApp(App)
app.use(store)
app.use(router)
app.use(ElementPlus)
app.mount('#app')
